package window

func NewStatistical(policy Policy) *Statistical {
	return &Statistical{
		policy: policy,
	}
}

type Statistical struct {
	policy Policy
}

func (s *Statistical) Avg() float64 {
	return s.policy.Reduce(Avg)
}

func (s *Statistical) Sum() float64 {
	return s.policy.Reduce(Sum)
}

func (s *Statistical) Count() int {
	return int(s.policy.Reduce(Count))
}

func (s *Statistical) Min() float64 {
	return s.policy.Reduce(Min)
}

func (s *Statistical) Max() float64 {
	return s.policy.Reduce(Max)
}
